home *** CD-ROM | disk | FTP | other *** search
/ El Mac 9 / El Mac 9.iso / Shareware / Applications / MathPad 2.4 / XFuns / XFun kit / util src / callback.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-01  |  3.4 KB  |  159 lines  |  [TEXT/CWIE]

  1. /*
  2.    Define callback routines with callback funptr passed as a parameter.
  3.    The compiler must be set so that type "double" is a SANE 80-bit.
  4. */
  5.  
  6. #include "xfuns.h"
  7. #include "callback.h"
  8.  
  9. void AddXfun(char *name,char *parms,funptr entry,funptr predef,funptr callback)
  10. {
  11.    (*callback)((long)ADDXFUN,name,parms,entry,predef);
  12. }
  13.  
  14. void AddFunDim(char *name,long lim,funptr callback)
  15. {
  16.    (*callback)((long)ADDFUNDIM,name,lim);
  17. }
  18.  
  19. void ErrMsg(char *fmt,char *str,funptr callback)
  20. {
  21.    (*callback)((long)ERRMSG,fmt,str);
  22. }
  23.  
  24. void FreeExpr(EXPR xpr,funptr callback)
  25. {
  26.    (*callback)((long)FREEXPR,xpr);
  27. }
  28.  
  29. short EvalExpr(EXPR xpr,double *num,funptr callback)
  30. {
  31.    return((*callback)((long)EVALEXPR,xpr,num));
  32. }
  33.  
  34. short GetExprMatrix(EXPR xpr,double **mat,long *rows,long *cols,funptr callback)
  35. {
  36.    return((*callback)((long)GETEXPRMATRIX,xpr,mat,rows,cols));
  37. }
  38.  
  39. short GetParmVal(long n,double *num,funptr callback)
  40. {
  41.    return((*callback)((long)GETPARMVAL,(long) n,num));
  42. }
  43.  
  44. void MakeParmExpr(long n,EXPR *xpr,funptr callback)
  45. {
  46.    (*callback)((long)MAKEPARMEXPR,(long) n,xpr);
  47. }
  48.  
  49. short ProbeExpr(EXPR xpr,double *num,short *isarray,long *count,funptr callback)
  50. {
  51.    return((*callback)((long)PROBEXPR,xpr,num,isarray,count));
  52. }
  53.  
  54. short GetParmName(long n,char **name,funptr callback)
  55. {
  56.    return((*callback)((long)GETPARMNAME,(long) n,name));
  57. }
  58.  
  59. void AddIndex(EXPR *xpr,double **iptr,funptr callback)
  60. {
  61.    (*callback)((long)ADDINDEX,xpr,iptr);
  62. }
  63.  
  64. void RemoveIndex(EXPR *xpr,funptr callback)
  65. {
  66.    (*callback)((long)REMOVEINDEX,xpr);
  67. }
  68.  
  69. short GetVarVal(char *name,double *num,funptr callback)
  70. {
  71.    return((*callback)((long)GETVARVAL,name,num));
  72. }
  73.  
  74. void MakeVarExpr(char *name,EXPR *xpr,funptr callback)
  75. {
  76.    (*callback)((long)MAKEVAREXPR,name,xpr);
  77. }
  78.  
  79. short SetVarVal(char *name,double num,funptr callback)
  80. {
  81.    return((*callback)((long)SETVARVAL,name,&num));    /* callback parm must be ptr size */
  82. }
  83.  
  84. short SetVarMatrix(char *name,double *arr,long rows,long cols,funptr callback)
  85. {
  86.    return((*callback)((long)SETVARMATRIX,name,arr,rows,cols));
  87. }
  88.  
  89. void FoldVar(char *name,long lim,funptr callback)
  90. {
  91.    (*callback)((long)FOLDVAR,name,lim);
  92. }
  93.  
  94. short Stopped(funptr callback)
  95. {
  96.    return((*callback)((long)STOPPED));
  97. }
  98.  
  99. void SpinWatch(funptr callback)
  100. {
  101.    (*callback)((long)SPINWATCH);
  102. }
  103.  
  104. void SetPlotPICT(PicHandle thePic,funptr callback )
  105. {
  106.    (*callback)((long)SETPLOTPICT,thePic);
  107. }
  108.  
  109. void SizePlotPICT(double left,double bot,double width,double ht,funptr callback)
  110. {
  111.    (*callback)((long)SIZEPLOTPICT,&left,&bot,&width,&ht);    /* callback parm must be ptr size */
  112. }
  113.  
  114. void GetVarString(char *name,char **str,funptr callback )
  115. {
  116.    (*callback)((long)GETVARSTRING,name,str);
  117. }
  118.  
  119. short GetDocInfo(long *docref,FSSpec *fspec,WindowPtr *plotwindow,funptr callback)
  120. {
  121.    (*callback)((long)GETDOCINFO,docref,fspec,plotwindow);
  122. }
  123.  
  124. void GetAngleUnits(double *unit,funptr callback)
  125. {
  126.    (*callback)((long)GETANGLEUNITS,unit);
  127. }
  128.  
  129. void GetAxisRect(Rect *axisrect,funptr callback)
  130. {
  131.    (*callback)((long)GETAXISRECT,axisrect);
  132. }
  133.  
  134. void GetAxisLimits(double limits[6],funptr callback)
  135. {
  136.    (*callback)((long)GETAXISLIMITS,limits);
  137. }
  138.  
  139. void GetPlotInfo(double info[12],funptr callback)
  140. {
  141.    (*callback)((long)GETPLOTINFO,info);
  142. }
  143.  
  144. short Sprintf(char *buf,char *fmt,double num,funptr callback)
  145. {
  146.    (*callback)((long)SPRINTF,buf,fmt,&num);
  147. }
  148.  
  149. void MapData(double x,double y,short *xpixel,short *ypixel,funptr callback)
  150. {
  151.    (*callback)((long)MAPDATA,&x,&y,xpixel,ypixel);
  152. }
  153.  
  154. extern void ReturnVoid(funptr callback)
  155. {
  156.    (*callback)((long)RETURNVOID);
  157. }
  158.  
  159.